package com.common.base;

import com.entity.sys.SysUser;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


public abstract class BaseController<S extends BaseService, E extends BaseEntity>{

    @Resource
    protected HttpServletRequest httpServletRequest;
    @Autowired(required=false)
    protected S service;

    public String token(){
        return httpServletRequest.getHeader(BaseConstant.tokenHeader);
    }

    /**
     * 获取当前登录的用户
     */
    public SysUser getCurrentUser(){
        return service.getCurrentUser();
    }

}
